/*

	Singleton Mutator
	------------------

	@file 		Class.Mutators.Singleton.js
	@date 		2008-11-10
	@author 	Nathan White <http://www.nwhite.net/?p=169>

	Copyright (c) 2008 Nathan White <http://www.nwhite.net>

*/

Class.Mutators.Singleton = function(self,flag){
	if(!flag) return;
	self.constructor.__instance = undefined;
	if($defined(self.initialize) && $type(self.initialize) == 'function') var init = self.initialize;
	self.initialize = function(){
		if(!$defined(this.constructor.__instance)){
			if($defined(init) && $type(init) == 'function') init.apply(this,arguments);
			this.constructor.__instance = this;
		}
		return this.constructor.__instance;
	}
}